//传单参
#include <my_head.h>
void *task_func(void *arg){
    printf("我是子线程 arg = %p\n",arg);//和main函数中的value的地址相同
    #if 0
    int *p = (int *)arg;
    printf("我是子线程 %d\n",*p);
    #else
    int num = *(int *)arg;
    printf("我是子进程 %d\n",num);
    #endif
}

int main(int argc, char const *argv[])
{
    int value = 2222;
    printf("我是主线程 &value = %p\n",&value);
    pthread_t tid = 0;
    int ret = 0;
    if(0 != (ret = pthread_create(&tid,NULL,task_func,&value))){
        printf("pthread_create error : [%d] [%s]\n",ret,strerror(ret));
        exit(EXIT_FAILURE);
    }
    printf("我是主线程 value = %d\n",value);
    sleep(100);
    return 0;
}
